#include <stdio.h>
#include "../constants.hpp"
#include "SpeculativeNextBatch.hpp"

using namespace BFT::messages;

SpeculativeNextBatch::SpeculativeNextBatch(uint32_t _view, boost::shared_ptr<NextBatch> _nb)
{

SpeculativeNextBatch::SpeculativeNextBatch(_view, _nb.get()->getSeqNo(), _nb.get()->getHistory(), 
						     _nb.get()->getCommands(), _nb.get()->getNonDeterminism(), _nb.get()->getCPDigest(),
						     _nb.get()->getTakeCP(), _nb.get()->getSendingReplica());
}

SpeculativeNextBatch::SpeculativeNextBatch(  uint32_t _view, uint32_t _seq,
					     boost::shared_ptr<HistoryDigest> _history,
					     boost::shared_ptr<CommandBatch> _commands,
					     boost::shared_ptr<NonDeterminism> _nondet,
					     boost::shared_ptr<Digest> _cpDig, bool _cp, uint32_t _sendingReplica)
	: NextBatch::NextBatch(SPECULATIVE_NEXT_BATCH, _view, _seq, _history, _commands, _nondet, _cpDig, _cp , _sendingReplica)
{}

SpeculativeNextBatch::SpeculativeNextBatch(uint32_t _view, uint32_t _seq,
					     boost::shared_ptr<CertificateEntry> _entry,
					     bool _cp, uint32_t _sendingReplica)
	: NextBatch::NextBatch(SPECULATIVE_NEXT_BATCH, _view, _seq, _entry, _cp, _sendingReplica)
{}
					     
SpeculativeNextBatch::SpeculativeNextBatch(boost::shared_ptr<char> _bytes, int _bytes_size)
	: NextBatch::NextBatch(_bytes, _bytes_size)
{
	if (getTag() != SPECULATIVE_NEXT_BATCH)
	{
		fprintf(stderr,"expected tag %d (speculative next batch), real tag %d (? ? ?)\n",SPECULATIVE_NEXT_BATCH, getTag());
	}	
}

